package com.company.jdk8;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class SjTest {

    public static void main(String[] args) throws ParseException {
        //这边默认认为plc传的是北京时间，然后截取 年月日+时分秒，进行处理
        String strTime = "2021-10-26T14:51:10.420845";
        String subPrefix = strTime.substring(0,10);
        String subSuffix = strTime.substring(11,19);
        System.err.println(subPrefix);
        System.err.println(subSuffix);
        SimpleDateFormat df =
                new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = df.parse(subPrefix+" "+subSuffix);
        System.err.println(date);

    }
}
